package net.hands.ado;

import java.util.Collection;
import java.util.LinkedHashSet;

public class AbstractADOManager implements IADOManager {

	/**
	 * 监听器
	 */
	private Collection<IADOListener> listeners;

	protected Collection<IADOListener> getListeners() {
		if (listeners == null) {
			listeners = new LinkedHashSet<IADOListener>();
		}
		return listeners;
	}

	@Override
	public void addListener(IADOListener listener) {
		getListeners().add(listener);
	}

	@Override
	public boolean removeListener(IADOListener listener) {
		return getListeners().add(listener);
	}

	@Override
	public void reset() {
		getListeners().clear();
	}

}
